'*********************************************
'*****************This Script File Includes Many Fun Commands
'****************That many users desire, but I would NEVER-EVER hardcode into my bot
'(a big waste of time, memory, and speed).   by The-FooL
'  USAGE:
' .shout <text> - MESSAGE IN ALL CAPS
' .expand <text> - E x p a n d s   T e x T
' .ask8ball <question> - Asks the 8ball a questoins
' .flip - Returns "Heads." or "Tails."
'  More to come(!!or add your own!!)


'Dim all Module Level Variables HERE
Const ScriptVer="FunCommands V0.5 by The-FooL"
dim stMagicString(28) 'magic 8ball text


'************
'//This Sub Is called When the script File is loaded
'**********
Sub Event_Load()
	ssc.AddChat vbgreen, "Fun Commands Loaded!"
	randomize'for random elements in commands

'initialize 8ball array
stMagicString(1) = "As I see It, Yes"
stMagicString(2) = "It is certain"
stMagicString(3) = "It is decidedly so"
stMagicString(4) = "Most likely"
stMagicString(5) = "Outlook good"
stMagicString(6) = "Signs point to Yes"
stMagicString(7) = "Without a doubt"
stMagicString(8) = "YES"
stMagicString(9) = "Yes, definitely"
stMagicString(10) = "You may rely on it"
stMagicString(11) = "Ask again later"
stMagicString(12) = "Better not tell you now"
stMagicString(13) = "Cannot predict now"
stMagicString(14) = "Concentrate and ask again"
stMagicString(15) = "Don't count on it"
stMagicString(16) = "My reply is No"
stMagicString(17) = "My sources say No"
stMagicString(18) = "Outlook not so good"
stMagicString(19) = "Reply Hazy, Try again"
stMagicString(20) = "Very doubtful"
stMagicString(21) = "Not only no, but HELL No!"
stMagicString(22) = "Not only yes, but HELL Yes!"
stMagicString(23) = "You will regret it!"
stMagicString(24) = "Signs point to No"
stMagicString(25) = "Go away... I don't want you back!"
stMagicString(26) = "Well I love you, come back!"
stMagicString(27) = "What? Are you taking me as an 8 ball?"
stMagicString(28) = "Outlook is disturbing"
	
End Sub



'************
'//Bot has logged onto Battle.net  SCGateway is the
'    SCGateway - "useast", "uswest", "asia", etc
'    WCGateway - "Azeroth", "Northrend", etc.
'    Both of the above are passed regardless of product
'****************
Sub Event_LoggedOn(Username, Product, SCGateway, WCGateway)
	'ssc.addChat "(BlankScript)Logged Onto " & SCGateway & "/" & WCGateway
End Sub


Sub Event_Usertalk(Username, Flags, Message, Ping)


End Sub


'///My semi-Complex On Join Sub
'    Parsed Statstring - Contains the parsed statstring of the user
'    OrigStatString - Contains the unmodifed statstring of the user
'    Clan - WC Clan(If applicable)
'    GreetUser -   If false, then that means the user has already been
'    marked as banned(ban has been sent to que).  You should take advantage
'    Of this to not waste time with the user.  
'    
' //This is a Function(Default return value is always false).  If you set the return
'  value to TRUE ( Event_UserJoins=TRUE) then the greetUser variable will be set
'  to false(bot greets will not be sent, and user will not be checked for 
'  mail/lastseen).
' //Because I have already retrieved Access and Safelisted status, I have passed those
'    as well
'    
'**************
Function Event_UserJoins(Username, Flags, ParsedStatString, OrigStatString, Product, Clan, Ping, Access, safeListed, GreetUser)


End Function


Sub Event_ServerInfo(Message) 


End Sub


Sub Event_ServerError(Message)

End Sub



Sub Event_UserEmote(Username, Flags, Message)

End Sub


Sub Event_WhisperFromUser(Username, Flags, Message)

End Sub


Sub Event_WhisperToUser(Username, Flags, Message)

End Sub


Sub Event_UserLeaves(Username, Flags)

End Sub

Sub Event_FlagUpdate(Username, NewFlags, Ping, Message)

End Sub

Sub Event_UserInChannel(Username, Flags, Message, Ping, Product, OrigStatString)
IF Username="Matches" AND Ping<47 AND FALSE THEN
   ssc.botcommand "/reconnect","Matches",true
END IF
End Sub

Sub Event_ChannelJoin(ChannelName) ' Bot joins a different Channel
	
End Sub


Sub scTimer_Timer() ' fires when the timer goes off

'//Timer Settings can be modifed with the added ScriptTimer Object
'//ScriptTimer.Enabled=True, ScriptTimer.Interval=1000, etc


End Sub


'************
'//Fires when enter is pressed in the send box
'    ''This is a function.  By default the return value is false.
'      However, if you set the return value to TRUE(Event_PressedEnter=True)
'      Then the text will not be processed by the bot as normal
Function Event_PressedEnter(Text)
	'if text="/dontsent" then Event_PressedEnter=True
End Function

'************
'//FooLOps Command Processor
'    I added a seperate sub for a command processor, called directly by my command 
'    processor.  This sub is called only after triggers have been parsed, and
'    multiple commands have been split.  The Ops Commands(Bans, unbans, or whatever I
'    have in my ops commands sub) have precedence over this.  If they are parsed, 
'    then this sub will never be called.
'
'///Here is how you parse/return the command.  "Command" contains the first word, 
'   the actual command(no trigger).  Rest is the rest of the command
'  (whatever follows, if anything).
'   Set the return value with Event_ParseCommand="Return Message"
'   If the return message is blank, then the bot will consider the command unparsed
'   and continue to search through the rest of the commands list
'   If the return message is a single space ' ', then the bot will consider the command
'   parsed but will not return anything to the que or bot window.
'   Any real return message will either be added directly to the que(you can use 
'   vbCrLfs for multiple lines), or send to the bot window(depending on where the
'   command was called from.
'   All script command processors are processed simultaneosly, so that they will not interfere with eachother.

' It is also important to note that in addition to this, Event_Usertalk or Event_WhisperFromUser can also be called.


Function Event_ParseCommand(Command, Rest, Username, Access, Inbot)
select case command
	case "scriptver"
	   if access<20 then exit function
	   event_parsecommand =ScriptVer
        case "flip"
	If access<20 then exit function
	   coin=int(rnd*2)
		if coin=0 THEN
			event_parsecommand="Heads."
		else
			event_parsecommand="Tails."
		END IF
	case "ask8ball", "8ball"
		if access<20 then exit function
		stNum = Int(Rnd * (28 - 1)) + 1
		event_parsecommand= "/me looks into his Magic 8 Ball: " & stMagicString(stNum)
	case "shout"
		if access<40 then exit function
		event_parsecommand=Replace(UCase(Rest),"/",vbNullString)
	case "expand"
		if access<40 then exit function
		dim retstr
		while(left(rest,1)="/")'remove preceding /s from respsonse
			rest=mid(rest,2)
		wend
		for x=1 to len(rest)
			retstr=retstr & mid(rest,x,1) & " "
		next
		event_parsecommand=retstr
	case else
	'put as many cases as you need for this scripts commands

end select

End Function

'///When The Script File is Unloaded(Bot Close)
Sub Event_Close()
	
End Sub

